*------------- Upper-Body Strength and Political Egalitarianism: Twelve Conceptual Replications ------------------------------------*
*----------------------------------------------------- STUDY 6 ---------------------------------------------------------------------*

**** Creates and recodes variables (partly based on re-reading and recoding of handwritten surveys)
* (As a general rule, when a participant provided 2 answers (e.g., circled both 1 and 2) then she/he is coded as the lowest value (in this example, 1)).


**** Background variables - age, sex and social class

** Participant age
codebook age

generate ageRec=.
replace ageRec=17 if age=="17"
replace ageRec=18 if age=="18"
replace ageRec=19 if age=="19"
replace ageRec=20 if age=="20"
replace ageRec=21 if age=="21"
replace ageRec=22 if age=="22"
replace ageRec=23 if age=="23"
replace ageRec=24 if age=="24"
replace ageRec=25 if age=="25"
replace ageRec=26 if age=="26"
replace ageRec=27 if age=="27"
replace ageRec=28 if age=="28"
replace ageRec=29 if age=="29"
replace ageRec=30 if age=="30"
replace ageRec=31 if age=="31"
replace ageRec=32 if age=="32"
replace ageRec=33 if age=="33"
replace ageRec=34 if age=="34"
replace ageRec=35 if age=="35"
replace ageRec=36 if age=="36"
replace ageRec=18 if age=="18 or 19. Diffiult to tell"
replace ageRec=20 if age=="21 I think. Difficult to tell"
replace ageRec=21 if age=="Born 1995, so 21 or 22"
replace ageRec=20 if ppnr=="1037"
replace ageRec=20 if ppnr=="1037"
replace ageRec=19 if ppnr=="1057"
replace ageRec=19 if ppnr=="1058"
replace ageRec=17 if ppnr=="1101"
tabulate ageRec

** Notes reagrding age coding
*Checked age for participant numbers
*77 "21 I think. Difficult to tell". Coded as 20.
*1037 "Difficult to tell" Coded as 20.
*1057 "1". Now coded as missing. coded as 19.
*1058 "18 or 19. Diffiult to tell". coded as 19.
*1101 "Difficult to tell". coded as 17.

summarize ageRec
hist ageRec

** Participant sex (0 = female; 1 = male)
codebook sex
generate male=.
replace male=0 if sex=="2"
replace male=0 if sex=="2 (I think?)"
replace male=1 if sex=="1"
tabulate male


** Social Class
codebook class
tabulate class
generate classRec=.
replace classRec=1 if class=="1"
replace classRec=2 if class=="2"
replace classRec=3 if class=="3"
replace classRec=4 if class=="4"
replace classRec=5 if class=="5"
replace classRec=6 if class=="6"
replace classRec=7 if class=="7"
replace classRec=8 if class=="8"
replace classRec=9 if class=="9"
replace classRec=10 if class=="10"
replace classRec=6 if class=="6 and 7"
replace classRec=6 if class=="6 or 7"
replace classRec=5 if class=="Between 5 and 6"
replace classRec=7 if class=="Both 7 and 8"
replace classRec=4 if class=="The respondent has circled both 4 and 5. "
tabulate classRec
summarize classRec


** Recodes class variable to 0-1 scale reflecting min and max value
generate class01 = (classRec-1)/(10-1)
summarize class01


** Physical strength variable
codebook strength
tabulate strength
generate strengthRec=.
replace strengthRec=0 if strength=="0"
replace strengthRec=10 if strength=="10"
replace strengthRec=20 if strength=="20"
replace strengthRec=30 if strength=="30"
replace strengthRec=40 if strength=="40"
replace strengthRec=50 if strength=="50"
replace strengthRec=60 if strength=="60"
replace strengthRec=70 if strength=="70"
replace strengthRec=80 if strength=="80"
replace strengthRec=90 if strength=="90"
replace strengthRec=100 if strength=="100"
replace strengthRec=0 if strength=="Difficult to see. He either wrote 0% or 30%"
replace strengthRec=0 if strength=="0 and 40"
replace strengthRec=40 if strength=="40 and/or 60"
* Note: Participant number 15: "The respondent has answered something else, which has not been translated". Transl. "no answer". Coded as missing.

tabulate strengthRec
summarize strengthRec

** Recodes strength variable to 0-1 scale with 0 and 1 reflecting min and max strength within sex
summ strengthRec if male == 0
generate phys_strength = (strengthRec-(r(min)))/(r(max)-r(min)) if male == 0

summ strengthRec if male == 1
replace phys_strength = (strengthRec-(r(min)))/(r(max)-r(min)) if male == 1

bys male: summarize phys_strength


*** Social Dominance Orientation
* SDO item 1
tabulate sdo1
codebook sdo1

generate sdo1Rec=.
replace sdo1Rec=0 if sdo1=="0"
replace sdo1Rec=1 if sdo1=="1"
replace sdo1Rec=2 if sdo1=="2"
replace sdo1Rec=3 if sdo1=="3"
replace sdo1Rec=4 if sdo1=="4"
replace sdo1Rec=5 if sdo1=="5"
replace sdo1Rec=6 if sdo1=="6"
replace sdo1Rec=0 if sdo1=="Respondent has circled both 0 and 2"
codebook sdo1Rec

* SDO item 2
codebook sdo2
tabulate sdo2
generate sdo2Rec=.
replace sdo2Rec=0 if sdo2=="0"
replace sdo2Rec=1 if sdo2=="1"
replace sdo2Rec=2 if sdo2=="2"
replace sdo2Rec=3 if sdo2=="3"
replace sdo2Rec=4 if sdo2=="4"
replace sdo2Rec=5 if sdo2=="5"
replace sdo2Rec=6 if sdo2=="6"
replace sdo2Rec=0 if sdo2=="0 and 5"
replace sdo2Rec=1 if sdo2=="1 and 3"
replace sdo2Rec=3 if sdo2=="3 and 4"
replace sdo2Rec=0 if sdo2=="Respondent has circled both 0 and 2"
replace sdo2Rec=1 if sdo2=="The respondent has circled both 1 and 2"
codebook sdo2Rec

* SDO item 3
tabulate sdo3
generate sdo3Rec=.
replace sdo3Rec=0 if sdo3=="0"
replace sdo3Rec=1 if sdo3=="1"
replace sdo3Rec=2 if sdo3=="2"
replace sdo3Rec=3 if sdo3=="3"
replace sdo3Rec=4 if sdo3=="4"
replace sdo3Rec=5 if sdo3=="5"
replace sdo3Rec=6 if sdo3=="6"
replace sdo3Rec=0 if sdo3=="Respondent has circled both 0 and 4"
codebook sdo3Rec

* SDO item 4
tabulate sdo4
generate sdo4Rec=.
replace sdo4Rec=0 if sdo4=="0"
replace sdo4Rec=1 if sdo4=="1"
replace sdo4Rec=2 if sdo4=="2"
replace sdo4Rec=3 if sdo4=="3"
replace sdo4Rec=4 if sdo4=="4"
replace sdo4Rec=5 if sdo4=="5"
replace sdo4Rec=6 if sdo4=="6"
replace sdo4Rec=5 if sdo4=="Respondent has circled both 5 and 6"
codebook sdo4Rec

** Generates SDO scale
alpha sdo1Rec sdo2Rec sdo3Rec sdo4Rec, item
* recodes items 3, 4 such that higher value reflects more socially dominant position
recode sdo3Rec sdo4Rec (0=6) (1=5) (2=4) (3=3) (4=2) (5=1) (6=0), generate (sdo3RecR sdo4RecR)

alpha sdo1Rec sdo2Rec sdo3RecR sdo4RecR

egen sdo =rmean(sdo1Rec sdo2Rec sdo3RecR sdo4RecR)
summarize sdo


** Recodes SDO scale to 0-1 scale with 0 and 1 reflecting min and max for amles and females, respectively
summ sdo if male == 0
generate SDO = (sdo-(r(min)))/(r(max)-r(min)) if male == 0

summ sdo if male == 1
replace SDO = (sdo-(r(min)))/(r(max)-r(min)) if male == 1

bys male: summarize SDO


*-------------------------------------------------------- ANALYSES ----------------------------------------------------*

***** Descriptives
tab male if ageRec !=.
summ ageRec

bys male: summ phys_strength

alpha sdo1Rec sdo2Rec sdo3RecR sdo4RecR
bys male: summ SDO


**** Main effects
** Females
reg SDO phys_strength c.ageRec if male == 0 

** Males
reg SDO phys_strength c.ageRec if male == 1


**** Interactios with self-perceived status
** Females
reg SDO c.phys_strength##c.class01 c.ageRec if male == 0

margins, dydx(phys_strength) at(class01=(0 (0.05) 1.0))
marginsplot, recastci(rline) ciopts(lpattern(dash)) recast(line) yline(0) xlabel(#10) ///
xtitle(Socio-Economic Status) ytitle(Marg. effect of self-perceived formidability) title("") scheme(s2mono)

** Males
reg SDO c.phys_strength##c.class01 c.ageRec if male == 1

margins, dydx(phys_strength) at(class01=(0 (0.05) 1.0))
marginsplot, recastci(rline) ciopts(lpattern(dash)) recast(line) yline(0) xlabel(#10) ///
xtitle(Socio-Economic Status) ytitle(Marg. effect of self-perceived formidability) title("") scheme(s2mono)
